<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,IE=9,chrome=1"><meta name="generator" content="MATLAB 2021a"><title>Flux Balance Analysis</title><style type="text/css">.rtcContent { padding: 30px; } .S0 { margin: 3px 10px 5px 4px; padding: 0px; line-height: 28.8px; min-height: 0px; white-space: pre-wrap; color: rgb(213, 80, 0); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 24px; font-weight: normal; text-align: left;  }
.S1 { margin: 20px 10px 5px 4px; padding: 0px; line-height: 20px; min-height: 0px; white-space: pre-wrap; color: rgb(60, 60, 60); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;  }
.S2 { margin-bottom: 20px; padding-bottom: 4px;  }
.S3 { margin: 0px; padding: 10px 0px 10px 5px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(0, 0, 0); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: normal; text-align: start;  }
.S4 { margin: -1px 0px 0px; padding: 10px 0px 10px 7px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(0, 0, 0); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: normal; text-align: start;  }
.S5 { margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(0, 0, 0); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: normal; text-align: left;  }
.CodeBlock { background-color: #F7F7F7; margin: 10px 0 10px 0;}
.S6 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 1px solid rgb(233, 233, 233); border-bottom: 0px none rgb(0, 0, 0); border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px;  }
.S7 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 0px none rgb(0, 0, 0); border-bottom: 0px none rgb(0, 0, 0); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px;  }
.S8 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 0px none rgb(0, 0, 0); border-bottom: 1px solid rgb(233, 233, 233); border-radius: 0px 0px 4px 4px; padding: 0px 45px 4px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px;  }
.S9 { margin: 10px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(0, 0, 0); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: normal; text-align: center;  }
.S10 { margin: 10px 0px 20px; padding-left: 0px; font-family: Helvetica, Arial, sans-serif; font-size: 14px;  }
.S11 { margin-left: 56px; line-height: 21px; min-height: 0px; text-align: left; white-space: pre-wrap;  }
.S12 { margin: 10px 10px 5px 4px; padding: 0px; line-height: 18px; min-height: 0px; white-space: pre-wrap; color: rgb(60, 60, 60); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 15px; font-weight: bold; text-align: left;  }
.S13 { margin: 3px 10px 5px 4px; padding: 0px; line-height: 20px; min-height: 0px; white-space: pre-wrap; color: rgb(60, 60, 60); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left;  }</style></head><body><div class = rtcContent><h1  class = 'S0' id = 'T_4CE2BBD0' ><span>Flux Balance Analysis</span></h1><h2  class = 'S1' id = 'H_8C6952DD' ><span>Author(s): Ronan M.T. Fleming, Leiden University</span></h2><h2  class = 'S1' id = 'H_13B2214D' ><span>Reviewer(s):</span></h2><div  class = 'S2'><div  class = 'S3'><span style=' font-weight: bold;'>Table of Contents</span></div><div  class = 'S4'><a href = "#H_8C6952DD"><span>Author(s): Ronan M.T. Fleming, Leiden University
</span></a><a href = "#H_13B2214D"><span>Reviewer(s):
</span></a><a href = "#H_BBAA3A65"><span>INTRODUCTION
</span></a><a href = "#H_4EC8492F"><span>TIMING
</span></a><a href = "#H_7E629399"><span>E. coli core model
</span></a><a href = "#H_7E2A567B"><span>MATERIALS - EQUIPMENT SETUP
</span></a><a href = "#H_B642E8E4"><span>PROCEDURE
</span></a><a href = "#H_ED106D18"><span>Load E. coli core model
</span></a><a href = "#H_CDF14152"><span>Checking the non-trivial constraints on a model
</span></a><span>    </span><a href = "#H_26981136"><span>What are the default constraints on the model? 
</span></a><span>    </span><a href = "#H_68230CB2"><span>Hint: printConstraints
</span></a><a href = "#H_90B9DC5C"><span>Example 1: Calculating growth rates
</span></a><span>    </span><a href = "#H_A92CE043"><span>What is the growth rate of E. coli on glucose (uptake rate = 18.5 mmol/gDW/h) under aerobic conditions?  
</span></a><span>    </span><a href = "#H_B45CB333"><span>Hint: changeRxnBounds, changeObjective, optimizeCbModel, printFluxVector
</span></a><span>    </span><a href = "#H_0608C879"><span>What are the main fields to check in the FBAsolution structure?
</span></a><span>    </span><a href = "#H_1CC23FBC"><span>Hint: help optimizeCbModel
</span></a><span>    </span><a href = "#H_E9ECB9DC"><span>What does FBAsolution.stat mean?
</span></a><a href = "#H_DC34B7FD"><span>Example 2: Display an optimal flux vector on a metabolic map
</span></a><span>    </span><a href = "#H_D869E5BD"><span>Which reactions/pathways are in use (look at the flux vector and flux map)?
</span></a><span>    </span><a href = "#H_5B6D7800"><span>Hint: drawFlux
</span></a><a href = "#H_A979034D"><span>Example 3:  Anerobic growth
</span></a><span>    </span><a href = "#H_83445B00"><span>What is the optimal growth rate under anaerobic conditions?
</span></a><span>    </span><a href = "#H_7BE1CB82"><span>Hint: changeRxnBounds
</span></a><span>    </span><a href = "#H_4FC03281"><span>What reactions of oxidative phosphorylation are active in anaerobic conditions?
</span></a><span>    </span><a href = "#H_D7AB05E2"><span>Hint: printFluxVector drawFlux
</span></a><a href = "#H_1BC34D4B"><span>Example 3:  Growth on alternate substrates
</span></a><span>    </span><a href = "#H_FE29AE56"><span>What is the growth rate of E. coli on succinate?
</span></a><span>    </span><a href = "#H_5B262D90"><span>Hint: changeRxnBounds
</span></a><a href = "#H_4B71AED6"><span>REFERENCES</span></a></div></div><h2  class = 'S1' id = 'H_BBAA3A65' ><span>INTRODUCTION</span></h2><div  class = 'S5'><span>In this practical, the use of Flux Balance Analysis (FBA) is introduced using the E. coli core model, with functions in the COBRA Toolbox v3.0 [2].  </span></div><div  class = 'S5'><span>Flux balance analysis is a solution to the optimisation problem</span></div><div  class = 'S5'><span texencoding="
\begin{array}{ll}
\textrm{max} &amp; c^{T}v\\
\text{s.t.} &amp; Sv=b\\
 &amp; l\leq v\leq u
\end{array}
\end{equation}" style="vertical-align:-25px"><img src="" width="96.5" height="61" /></span></div><div  class = 'S5'><span>where </span><span style="font-family: STIXGeneral, STIXGeneral-webfont, serif; font-style: italic; font-weight: normal; color: rgb(0, 0, 0);">c</span><span> is a vector of linear objective coefficients, </span><span style="font-family: STIXGeneral, STIXGeneral-webfont, serif; font-style: italic; font-weight: normal; color: rgb(0, 0, 0);">S</span><span> is an m times n matrix of stoichiometric coefficients for m molecular species involved in n reactions. </span><span mathmlencoding="&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;l&lt;/mi&gt;&lt;mtext&gt; &lt;/mtext&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;and&lt;/mi&gt;&lt;mtext&gt; &lt;/mtext&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;u&lt;/mi&gt;&lt;mtext&gt; &lt;/mtext&gt;&lt;/mrow&gt;&lt;/math&gt;" style="vertical-align:-5px"><img src="" width="45.5" height="18" /></span><span>are n times 1 vectors that are the lower and upper bounds on the n times 1 variable vector </span><span mathmlencoding="&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;italic&quot;&gt;v&lt;/mi&gt;&lt;mtext&gt; &lt;/mtext&gt;&lt;/mrow&gt;&lt;/math&gt;" style="vertical-align:-5px"><img src="" width="12.5" height="18" /></span><span>of reaction rates (fluxes). The optimal objective value is </span><span texencoding="c^{T}v^{\star}" style="vertical-align:-5px"><img src="" width="30" height="19" /></span><span>  is always unique, but the optimal vector </span><span texencoding="v^{\star}" style="vertical-align:-5px"><img src="" width="16.5" height="19" /></span><span> is usually not unique.</span></div><div  class = 'S5'><span>In summary, the data is {c,S,l,u} and the variable being optimised is v.</span></div><h2  class = 'S1' id = 'H_4EC8492F' ><span>TIMING</span></h2><div  class = 'S5'><span style=' font-style: italic;'>&lt; 1 hrs</span></div><h2  class = 'S1' id = 'H_7E629399' ><span>E. coli core model</span></h2><div  class = 'S5'><span>A map of the E. coli core model is shown in Figure 1. </span></div><div  class = 'S5'><img class = "imageNode" src = "" width = "908" height = "809" alt = "" style = "vertical-align: baseline"></img></div><div  class = 'S5'><span style=' font-weight: bold;'>Figure 1</span><span>  </span><span style=' font-weight: bold;'>Map of the core E. coli metabolic network. </span><span> Orange circles represent cytosolic metabolites, yellow circles represent extracellular metabolites, and the blue arrows represent reactions.  Reaction name abbreviations are uppercase (blue) and metabolite name abbreviations are lowercase (rust colour).  This flux map was drawn using SimPheny and edited for clarity with Adobe Illustrator. </span></div><h2  class = 'S1' id = 'H_7E2A567B' ><span>MATERIALS - EQUIPMENT SETUP</span></h2><div  class = 'S5'><span>Please ensure that all the required dependencies (e.g. , </span><span style=' font-family: monospace;'>git</span><span> and </span><span style=' font-family: monospace;'>curl</span><span>) of The COBRA Toolbox have been properly installed by following the installation guide </span><a href = "https://opencobra.github.io/cobratoolbox/stable/installation.html"><span>here</span></a><span>. Please ensure that the COBRA Toolbox has been initialised (tutorial_initialize.mlx) and verify that the pre-packaged LP and QP solvers are functional (tutorial_verify.mlx).</span></div><h2  class = 'S1' id = 'H_B642E8E4' ><span>PROCEDURE</span></h2><h2  class = 'S1' id = 'H_ED106D18' ><span>Load E. coli core model</span></h2><div  class = 'S5'><span>The most appropriate way to load a model into The COBRA Toolbox is to use the </span><span style=' font-family: monospace;'>readCbModel</span><span> function. </span></div><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S6'><span style="white-space: pre"><span >fileName = </span><span style="color: rgb(170, 4, 249);">'ecoli_core_model.mat'</span><span >;</span></span></div></div><div class="inlineWrapper"><div  class = 'S7'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">if </span><span >~exist(</span><span style="color: rgb(170, 4, 249);">'modelOri'</span><span >,</span><span style="color: rgb(170, 4, 249);">'var'</span><span >)</span></span></div></div><div class="inlineWrapper"><div  class = 'S7'><span style="white-space: pre"><span >    modelOri = readCbModel(fileName);</span></span></div></div><div class="inlineWrapper"><div  class = 'S7'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">end</span></span></div></div><div class="inlineWrapper"><div  class = 'S7'><span style="white-space: pre"><span style="color: rgb(2, 128, 9);">%backward compatibility with primer requires relaxation of upper bound on</span></span></div></div><div class="inlineWrapper"><div  class = 'S7'><span style="white-space: pre"><span style="color: rgb(2, 128, 9);">%ATPM</span></span></div></div><div class="inlineWrapper"><div  class = 'S7'><span style="white-space: pre"><span >modelOri = changeRxnBounds(modelOri,</span><span style="color: rgb(170, 4, 249);">'ATPM'</span><span >,1000,</span><span style="color: rgb(170, 4, 249);">'u'</span><span >);</span></span></div></div><div class="inlineWrapper"><div  class = 'S8'><span style="white-space: pre"><span >model = modelOri;</span></span></div></div></div><div  class = 'S9'><img class = "imageNode" src = "" alt = "" style = "vertical-align: baseline"></img></div><div  class = 'S5'><span>The meaning of each field in a standard model is defined in the </span><a href = "https://github.com/opencobra/cobratoolbox/blob/master/docs/source/notes/COBRAModelFields.md"><span>standard COBRA model field definition</span></a><span>.</span></div><div  class = 'S5'><span>In general, the following fields should always be present: </span></div><ul  class = 'S10'><li  class = 'S11'><span style=' font-weight: bold;'>S</span><span>, the stoichiometric matrix</span></li><li  class = 'S11'><span style=' font-weight: bold;'>mets</span><span>, the identifiers of the metabolites</span></li><li  class = 'S11'><span style=' font-weight: bold;'>b</span><span>, Accumulation (positive) or depletion (negative) of the corresponding metabolites. 0 Indicates no concentration change.</span></li><li  class = 'S11'><span style=' font-weight: bold;'>csense</span><span>, indicator whether the b vector is a lower bound ('G'), upper bound ('L'), or hard constraint 'E' for the metabolites.</span></li><li  class = 'S11'><span style=' font-weight: bold;'>rxns</span><span>, the identifiers of the reactions</span></li><li  class = 'S11'><span style=' font-weight: bold;'>lb</span><span>, the lower bounds of the reactions</span></li><li  class = 'S11'><span style=' font-weight: bold;'>ub</span><span>, the upper bounds of the reactions</span></li><li  class = 'S11'><span style=' font-weight: bold;'>c</span><span>, the linear objective</span></li><li  class = 'S11'><span style=' font-weight: bold;'>genes</span><span>, the list of genes in your model </span></li><li  class = 'S11'><span style=' font-weight: bold;'>rules</span><span>, the Gene-protein-reaction rules in a computer readable format present in your model.</span></li><li  class = 'S11'><span style=' font-weight: bold;'>osenseStr</span><span>, the objective sense either </span><span style=' font-family: monospace;'>'max'</span><span> for maximisation or </span><span style=' font-family: monospace;'>'min'</span><span> for minimisation</span></li></ul><h2  class = 'S1' id = 'H_CDF14152' ><span>Checking the non-trivial constraints on a model</span></h2><h4  class = 'S12' id = 'H_26981136' ><span>What are the default constraints on the model? </span></h4><h4  class = 'S12' id = 'H_68230CB2' ><span>Hint: </span><span style=' font-family: monospace;'>printConstraints</span></h4><h2  class = 'S1' id = 'H_89FF616D' ><span></span></h2><h2  class = 'S1' id = 'H_90B9DC5C' ><span>Example 1: Calculating growth rates</span></h2><div  class = 'S5'><span>Growth of E. coli on glucose can be simulated under aerobic conditions.  </span></div><h4  class = 'S12' id = 'H_A92CE043' ><span>What is the growth rate of </span><span style=' font-style: italic;'>E. coli </span><span>on glucose (uptake rate = 18.5 mmol/gDW/h) under aerobic conditions?  </span></h4><h4  class = 'S12' id = 'H_B45CB333' ><span>Hint: </span><span style=' font-family: monospace;'>changeRxnBounds</span><span>, </span><span style=' font-family: monospace;'>changeObjective</span><span>, </span><span style=' font-family: monospace;'>optimizeCbModel</span><span>, </span><span style=' font-family: monospace;'>printFluxVector</span></h4><div  class = 'S5'><span></span></div><h4  class = 'S12' id = 'H_0608C879' ><span>What are the main fields to check in the FBAsolution structure?</span></h4><h4  class = 'S12' id = 'H_1CC23FBC' ><span>Hint: </span><span style=' font-family: monospace;'>help optimizeCbModel</span></h4><div  class = 'S5'><span></span></div><h4  class = 'S12' id = 'H_E9ECB9DC' ><span>What does FBAsolution.stat mean?</span></h4><div  class = 'S5' id = 'H_BDFF40F9' ><span></span></div><h2  class = 'S1' id = 'H_DC34B7FD' ><span>Example 2: Display an optimal flux vector on a metabolic map</span></h2><h4  class = 'S12' id = 'H_D869E5BD' ><span>Which reactions/pathways are in use (look at the flux vector and flux map)?</span></h4><h4  class = 'S12' id = 'H_5B6D7800' ><span>Hint: </span><span style=' font-family: monospace;'>drawFlux</span></h4><div class="CodeBlock"><div class="inlineWrapper"><div  class = 'S6'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">if </span><span >exist(</span><span style="color: rgb(170, 4, 249);">'FBAsolution'</span><span >,</span><span style="color: rgb(170, 4, 249);">'var'</span><span >)</span></span></div></div><div class="inlineWrapper"><div  class = 'S7'><span style="white-space: pre"><span >    outputFormatOK = changeCbMapOutput(</span><span style="color: rgb(170, 4, 249);">'matlab'</span><span >);</span></span></div></div><div class="inlineWrapper"><div  class = 'S7'><span style="white-space: pre"><span >    map=readCbMap(</span><span style="color: rgb(170, 4, 249);">'ecoli_core_map'</span><span >);</span></span></div></div><div class="inlineWrapper"><div  class = 'S7'><span style="white-space: pre"><span >    options.zeroFluxWidth = 0.1;</span></span></div></div><div class="inlineWrapper"><div  class = 'S7'><span style="white-space: pre"><span >    options.rxnDirMultiplier = 10;</span></span></div></div><div class="inlineWrapper"><div  class = 'S7'><span style="white-space: pre"><span >    drawFlux(map, model, FBAsolution.v, options);</span></span></div></div><div class="inlineWrapper"><div  class = 'S8'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">end</span></span></div></div></div><h2  class = 'S13' id = 'H_A979034D' ><span>Example 3:  Anerobic growth</span></h2><div  class = 'S5'><span>Growth of E. coli on glucose can be simulated under anaerobic conditions.  </span></div><h4  class = 'S12' id = 'H_83445B00' ><span>What is the optimal growth rate under anaerobic conditions?</span></h4><h4  class = 'S12' id = 'H_7BE1CB82' ><span>Hint: changeRxnBounds</span></h4><div  class = 'S5'><span></span></div><h4  class = 'S12' id = 'H_4FC03281' ><span>What reactions of oxidative phosphorylation are active in anaerobic conditions?</span></h4><h4  class = 'S12' id = 'H_D7AB05E2' ><span>Hint: </span><span style=' font-family: monospace;'>printFluxVector</span><span> </span><span style=' font-family: monospace;'>drawFlux</span></h4><h2  class = 'S1' id = 'H_1BC34D4B' ><span>Example 3:  Growth on alternate substrates</span></h2><div  class = 'S5'><span>Just as FBA was used to calculate growth rates of E. coli on glucose, it can also be used to simulate growth on other substrates.  The core E. coli model contains exchange reactions for 13 different organic compounds, each of which can be used as the sole carbon source under aerobic conditions. </span></div><h4  class = 'S12' id = 'H_FE29AE56' ><span>What is the growth rate of </span><span style=' font-style: italic;'>E. coli </span><span>on succinate?</span></h4><h4  class = 'S12' id = 'H_5B262D90' ><span>Hint: </span><span style=' font-family: monospace;'>changeRxnBounds</span></h4><div  class = 'S5' id = 'H_4CAB641C' ><span style=' font-family: monospace;'></span></div><h2  class = 'S1' id = 'H_4B71AED6' ><span>REFERENCES</span></h2><div  class = 'S5'><span>1. Orth, J.D., Fleming, R.M. &amp; Palsson, B.O. in EcoSal - Escherichia coli and Salmonella Cellular and Molecular Biology. (ed. P.D. Karp) (ASM Press, Washington D.C.; 2009).</span></div><div  class = 'S5'><span>2. Varma, A. &amp; Palsson, B.O. Metabolic capabilities of Escherichia coli: I. Synthesis of biosynthetic precursors and cofactors. Journal of Theoretical Biology 165, 477-502 (1993).</span></div><div  class = 'S5'><span>3. Laurent Heirendt &amp; Sylvain Arreckx, Thomas Pfau, Sebastian N. Mendoza, Anne Richelle, Almut Heinken, Hulda S. Haraldsdottir, Jacek Wachowiak, Sarah M. Keating, Vanja Vlasov, Stefania Magnusdottir, Chiam Yu Ng, German Preciat, Alise Zagare, Siu H.J. Chan, Maike K. Aurich, Catherine M. Clancy, Jennifer Modamio, John T. Sauls, Alberto Noronha, Aarash Bordbar, Benjamin Cousins, Diana C. El Assal, Luis V. Valcarcel, Inigo Apaolaza, Susan Ghaderi, Masoud Ahookhosh, Marouen Ben Guebila, Andrejs Kostromins, Nicolas Sompairac, Hoai M. Le, Ding Ma, Yuekai Sun, Lin Wang, James T. Yurkovich, Miguel A.P. Oliveira, Phan T. Vuong, Lemmer P. El Assal, Inna Kuperstein, Andrei Zinovyev, H. Scott Hinton, William A. Bryant, Francisco J. Aragon Artacho, Francisco J. Planes, Egils Stalidzans, Alejandro Maass, Santosh Vempala, Michael Hucka, Michael A. Saunders, Costas D. Maranas, Nathan E. Lewis, Thomas Sauter, Bernhard Ø. Palsson, Ines Thiele, Ronan M.T. Fleming, </span><span style=' font-weight: bold;'>Creation and analysis of biochemical constraint-based models: the COBRA Toolbox v3.0</span><span>, Nature Protocols, volume 14, pages 639–702, 2019 </span><a href = "https://doi.org/10.1038/s41596-018-0098-2"><span>doi.org/10.1038/s41596-018-0098-2</span></a><span>.</span></div><div  class = 'S5'></div>
<br>
<!-- 
##### SOURCE BEGIN #####
%% Flux Balance Analysis
%% Author(s): Ronan M.T. Fleming, Leiden University
%% Reviewer(s):
%% INTRODUCTION
% In this practical, the use of Flux Balance Analysis (FBA) is introduced using 
% the E. coli core model, with functions in the COBRA Toolbox v3.0 [2].  
% 
% Flux balance analysis is a solution to the optimisation problem
% 
% $$\begin{array}{ll}\textrm{max} & c^{T}v\\\text{s.t.} & Sv=b\\ & l\leq v\leq 
% u\end{array}\end{equation}$$
% 
% where $c$ is a vector of linear objective coefficients, $S$ is an m times 
% n matrix of stoichiometric coefficients for m molecular species involved in 
% n reactions. $l\;\textrm{and}\;u\;$are n times 1 vectors that are the lower 
% and upper bounds on the n times 1 variable vector $v\;$of reaction rates (fluxes). 
% The optimal objective value is $c^{T}v^{\star}$  is always unique, but the optimal 
% vector $v^{\star}$ is usually not unique.
% 
% In summary, the data is {c,S,l,u} and the variable being optimised is v.
%% TIMING
% _< 1 hrs_
%% E. coli core model
% A map of the E. coli core model is shown in Figure 1. 
% 
% 
% 
% *Figure 1*  *Map of the core E. coli metabolic network.*  Orange circles represent 
% cytosolic metabolites, yellow circles represent extracellular metabolites, and 
% the blue arrows represent reactions.  Reaction name abbreviations are uppercase 
% (blue) and metabolite name abbreviations are lowercase (rust colour).  This 
% flux map was drawn using SimPheny and edited for clarity with Adobe Illustrator. 
%% MATERIALS - EQUIPMENT SETUP
% Please ensure that all the required dependencies (e.g. , |git| and |curl|) 
% of The COBRA Toolbox have been properly installed by following the installation 
% guide <https://opencobra.github.io/cobratoolbox/stable/installation.html here>. 
% Please ensure that the COBRA Toolbox has been initialised (tutorial_initialize.mlx) 
% and verify that the pre-packaged LP and QP solvers are functional (tutorial_verify.mlx).
%% PROCEDURE
%% Load E. coli core model
% The most appropriate way to load a model into The COBRA Toolbox is to use 
% the |readCbModel| function. 

fileName = 'ecoli_core_model.mat';
if ~exist('modelOri','var')
    modelOri = readCbModel(fileName);
end
%backward compatibility with primer requires relaxation of upper bound on
%ATPM
modelOri = changeRxnBounds(modelOri,'ATPM',1000,'u');
model = modelOri;
%% 
% 
% 
% The meaning of each field in a standard model is defined in the <https://github.com/opencobra/cobratoolbox/blob/master/docs/source/notes/COBRAModelFields.md 
% standard COBRA model field definition>.
% 
% In general, the following fields should always be present: 
%% 
% * *S*, the stoichiometric matrix
% * *mets*, the identifiers of the metabolites
% * *b*, Accumulation (positive) or depletion (negative) of the corresponding 
% metabolites. 0 Indicates no concentration change.
% * *csense*, indicator whether the b vector is a lower bound ('G'), upper bound 
% ('L'), or hard constraint 'E' for the metabolites.
% * *rxns*, the identifiers of the reactions
% * *lb*, the lower bounds of the reactions
% * *ub*, the upper bounds of the reactions
% * *c*, the linear objective
% * *genes*, the list of genes in your model 
% * *rules*, the Gene-protein-reaction rules in a computer readable format present 
% in your model.
% * *osenseStr*, the objective sense either |'max'| for maximisation or |'min'| 
% for minimisation
%% Checking the non-trivial constraints on a model
% What are the default constraints on the model? 
% Hint: |printConstraints|
%% 
%% Example 1: Calculating growth rates
% Growth of E. coli on glucose can be simulated under aerobic conditions.  
% What is the growth rate of _E. coli_ on glucose (uptake rate = 18.5 mmol/gDW/h) under aerobic conditions?  
% Hint: |changeRxnBounds|, |changeObjective|, |optimizeCbModel|, |printFluxVector|
% 
% What are the main fields to check in the FBAsolution structure?
% Hint: |help optimizeCbModel|
% 
% What does FBAsolution.stat mean?
% 
%% Example 2: Display an optimal flux vector on a metabolic map
% Which reactions/pathways are in use (look at the flux vector and flux map)?
% Hint: |drawFlux|

if exist('FBAsolution','var')
    outputFormatOK = changeCbMapOutput('matlab');
    map=readCbMap('ecoli_core_map');
    options.zeroFluxWidth = 0.1;
    options.rxnDirMultiplier = 10;
    drawFlux(map, model, FBAsolution.v, options);
end
%% Example 3:  Anerobic growth
% Growth of E. coli on glucose can be simulated under anaerobic conditions.  
% What is the optimal growth rate under anaerobic conditions?
% Hint: changeRxnBounds
% 
% What reactions of oxidative phosphorylation are active in anaerobic conditions?
% Hint: |printFluxVector| |drawFlux|
%% Example 3:  Growth on alternate substrates
% Just as FBA was used to calculate growth rates of E. coli on glucose, it can 
% also be used to simulate growth on other substrates.  The core E. coli model 
% contains exchange reactions for 13 different organic compounds, each of which 
% can be used as the sole carbon source under aerobic conditions. 
% What is the growth rate of _E. coli_ on succinate?
% Hint: |changeRxnBounds|
% 
%% REFERENCES
% 1. Orth, J.D., Fleming, R.M. & Palsson, B.O. in EcoSal - Escherichia coli 
% and Salmonella Cellular and Molecular Biology. (ed. P.D. Karp) (ASM Press, Washington 
% D.C.; 2009).
% 
% 2. Varma, A. & Palsson, B.O. Metabolic capabilities of Escherichia coli: I. 
% Synthesis of biosynthetic precursors and cofactors. Journal of Theoretical Biology 
% 165, 477-502 (1993).
% 
% 3. Laurent Heirendt & Sylvain Arreckx, Thomas Pfau, Sebastian N. Mendoza, 
% Anne Richelle, Almut Heinken, Hulda S. Haraldsdottir, Jacek Wachowiak, Sarah 
% M. Keating, Vanja Vlasov, Stefania Magnusdottir, Chiam Yu Ng, German Preciat, 
% Alise Zagare, Siu H.J. Chan, Maike K. Aurich, Catherine M. Clancy, Jennifer 
% Modamio, John T. Sauls, Alberto Noronha, Aarash Bordbar, Benjamin Cousins, Diana 
% C. El Assal, Luis V. Valcarcel, Inigo Apaolaza, Susan Ghaderi, Masoud Ahookhosh, 
% Marouen Ben Guebila, Andrejs Kostromins, Nicolas Sompairac, Hoai M. Le, Ding 
% Ma, Yuekai Sun, Lin Wang, James T. Yurkovich, Miguel A.P. Oliveira, Phan T. 
% Vuong, Lemmer P. El Assal, Inna Kuperstein, Andrei Zinovyev, H. Scott Hinton, 
% William A. Bryant, Francisco J. Aragon Artacho, Francisco J. Planes, Egils Stalidzans, 
% Alejandro Maass, Santosh Vempala, Michael Hucka, Michael A. Saunders, Costas 
% D. Maranas, Nathan E. Lewis, Thomas Sauter, Bernhard Ø. Palsson, Ines Thiele, 
% Ronan M.T. Fleming, *Creation and analysis of biochemical constraint-based models: 
% the COBRA Toolbox v3.0*, Nature Protocols, volume 14, pages 639–702, 2019 <https://doi.org/10.1038/s41596-018-0098-2 
% doi.org/10.1038/s41596-018-0098-2>.
% 
%
##### SOURCE END #####
-->
</div></body></html>